/**
 * Description:
 * Class Name:AppendContent
 * Date:2022/5/2 16:46
 *
 * @author LTisme
 * @version JAVA17
 */
package 疯狂Java讲义.第15章_输入输出._15_7_RandomAccessFile;

import java.io.IOException;
import java.io.RandomAccessFile;

public class AppendContent {
    public static void main(String[] args) {
        try (
                var raf = new RandomAccessFile("Chapter_15_7_out.txt", "rw")
                ){
            // 将文件记录指针定位到已有内容的最后
            raf.seek(raf.length());
            // 追加内容
            raf.write("追加的内容！\r\n".getBytes());
        }
        catch (IOException ioException){
            ioException.printStackTrace();
        }
    }
}
